#!/bin/sh

# release on Kloxo 6.1.7
# by mustafa.ramadhan@lxcenter.org

# ENVIRONMENT VARIABLE PRIMER FOR REFERENCE
# $0 script invoked
# $1, $2, $3 are the command line arguments
# $# Number of command line arguments 
# $@ all command line arguments - white space is preserved
# $* all command line arguments - white space striped 

if [ "$#" == 0 ] || [ "$1" == "--help" ] ; then
	echo
	echo " ------------------------------------------------------------------------------"
	echo "  format: sh $0 --select=<> --database=[]"
	echo " ------------------------------------------------------------------------------"
	echo "  --select - check/repair/optimize/upgrade"
	echo "  --database - database name; default: all databases"
	echo
	echo "  Must be running separately on each server (master and slave)"
	exit;
fi

request1=$1
SELECT=${request1#--select\=}

if [ ! "$SELECT" == 'check' ] && [ ! "$SELECT" == 'repair' ] && [ ! "$SELECT" == 'optimize' ] && [ ! "$SELECT" == 'upgrade' ] ; then
	echo "Wrong --select= entry..."
	exit;
fi

. /script/directory
lxphp.exe ../bin/fix/mysql-optimize.php $*
